<template>
  <div class="product-detail" v-if="productInfo.id">
    <button @click="$router.go(-1)">返回</button>
    <h1>{{ productInfo.name }}</h1>
    <p>id：{{ productInfo.id }}</p>
    <p>价格：{{ productInfo.price }}</p>
    <p>描述：{{ productInfo.dec }}</p>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      productInfo: {},
    };
  },
  async created() {
    const productId = this.$route.params.productId;
    const res = await axios.get(
      "http://localhost:9700/api/rest/boot/bill/" + productId
    );

    console.log(res);

    setTimeout(()=>this.productInfo = res.data,500)
  },
};
</script>

<style>
</style>